@extends('admin.layouts.app')

@section('css')
        <!-- Custombox css -->
       
        <link href="{{asset('admin/plugins/bootstrap-datepicker/css/bootstrap-datepicker.min.css')}}" rel="stylesheet">
         
@endsection 
@section('content')

                        <!-- Page-Title -->
                        <div class="row">
                            <div class="col-sm-12">
                                <h4 class="page-title">租赁管理</h4>
                                <ol class="breadcrumb">
                                    <li><a href="{{url('zadmin')}}">系统</a></li>
                                   
                                    <li><a href="{{url('zadmin/rent')}}">租赁列表</a></li>
                                    <li class="active">租赁日志</li>
                                </ol>
                            </div>
                        </div>
                        
                        <div class="row">
                          <div class="col-lg-12">
                <div class="panel panel-border panel-info">
                  <div class="panel-heading">
                    <h3 class="panel-title">租赁基本信息</h3>
                  </div>
                  <div class="panel-body">
                    <table class="table">
                      <thead>
                        <tr>
                          <th>客户</th>
                          <th>联系人</th>
                          <th>电话</th>
                          <th>车牌号</th>
                          <th>车型</th>
                          <th>租期</th>
                          <th></th>
                        </tr>
                      </thead>
                      <tbody>
                        <tr>
                          <td>{{$data->name}}</td>
                          <td>{{$data->contacter}}</td>
                          <td>{{$data->mobile}}</td>
                          <td>{{$data->car_num}}</td>
                          <td>{{$data->car_model}}</td>
                          <td>{{$data->rent_begin}}至{{$data->rent_end}}</td>
                          <td>
                            <button   class="btn btn-success btn-sm" id="showbox"  type="button">添加日志</button>
                          </td>
                        </tr>
                      </tbody>
                      
                    </table>
                  </div>
                </div>
              </div>
            </div>

            <div class="row" id="log-box" style="display: none">
                                <div class="col-md-12">
                                  <form method="post" action="{{url('zadmin/rent-log')}}" enctype="multipart/form-data">
                            {{ csrf_field()}}
                            <div class="row">
                                
                            

                            <div class="col-lg-12">
                                <div class="panel panel-border panel-info">
                                    <div class="panel-heading">
                                        <h3 class="panel-title">添加租赁日志</h3>
                                    </div>
                                    <div class="panel-body">
                                        
                                        <div class="row">    
                                        
                                            <div class="form-group col-md-6">
                                                
                                                <label class="col-md-3">本次租金<span class="text-danger">*</span></label>
                                                <div class="col-md-9">
                                                 <input class="form-control" name="price" required=""/>
                                                 </div>
                                                
                                            </div>
                                            <div class="form-group col-md-6">
                                                
                                                <label class="col-md-3">本次收款日<span class="text-danger">*</span></label>
                                                <div class="col-md-9">
                                                 <input class="form-control date" name="priced_at" required=""/>
                                                 </div>
                                                
                                            </div>
                                        </div>    
                                        <div class="row"> 
                                            <div class="form-group col-md-6">
                                                
                                                <label class="col-md-3">下次应收金额<span class="text-danger">*</span></label>
                                                <div class="col-md-9">
                                                 <input class="form-control" name="next_price" required=""/>
                                                 </div>
                                                
                                            </div>
                                       
                                            
                                        
                                            <div class="form-group col-md-6">
                                                
                                                <label class="col-md-3">下次收款日<span class="text-danger">*</span></label>
                                                <div class="col-md-9">
                                                 <input class="form-control date" name="next_date" required=""/>
                                                 </div>
                                                
                                            </div>
                                        </div>   
                                        <div class="row">
                                             <div class="form-group col-md-6">
                                                
                                                <label class="col-md-3">更换车车牌<span class="text-danger">*</span></label>
                                                <div class="col-md-9">
                                                 <input class="form-control" name="car_num" required=""/>
                                                 </div>
                                                
                                            </div>
                                             <div class="form-group col-md-6">
                                                
                                                <label class="col-md-3">更换车车型<span class="text-danger">*</span></label>
                                                <div class="col-md-9">
                                                 <input class="form-control" name="car_model" required=""/>
                                                 </div>
                                                
                                            </div>
                                        </div>
                                       
                                        
                                        <div class="row">    
                                        
                                           
                                             <div class="form-group col-md-6">
                                                
                                                <label class="col-md-3">还车日期<span class="text-danger">*</span></label>
                                                <div class="col-md-9">
                                                 <input class="form-control date" name="rebacked_at" required=""/>
                                                 </div>
                                                
                                            </div>

                                            <div class="form-group col-md-6">
                                          <label class="col-md-3">违章信息</label>
                                          <div class="col-md-9">
                                                <input class="form-control " name="weizhang_info" />
                                          </div>       
                                            </div>
                                            
                                        </div>
                                        

                                        <div class="row">    
                                        
                                           
                                             <div class="form-group col-md-6">
                                                
                                                <label class="col-md-3">出险情况<span class="text-danger">*</span></label>
                                                <div class="col-md-9">
                                                 <input class="form-control" name="baoxian_info" required=""/>
                                                 </div>
                                                
                                            </div>

                                            <div class="form-group col-md-6">
                                          <label class="col-md-3">备注</label>
                                          <div class="col-md-9">
                                                <input class="form-control " name="remark" />
                                          </div>       
                                            </div>
                                            
                                        </div>

                                        <div class="row">    
                                        
                                           
                                             <div class="form-group col-md-6">
                                                
                                                <label class="col-md-3">合同推送状态<span class="text-danger">*</span></label>
                                                <div class="col-md-9">
                                                 <input type="radio" name="rent_status" value="1" checked="" />继续推送
                                                 <input type="radio" name="rent_status" value="-1" />停止推送
                                                 </div>
                                                
                                            </div>

                                           
                                            
                                        </div>
                                       
                                        
                                    </div>
                                </div>
                            </div>

                            

                            <input type="hidden" name="rent_id" value="{{$data->id}}" />

                            <div class="col-lg-12">
                                <div class="form-group text-center">                                                
                                    <button type="submit" class="btn btn-info waves-effect waves-light">保存日志</button>
                                </div>
                            </div>                           
                        </div>




                                

                                        

                                    </div>

                                </div>
            <div class="row">
                        	<div class="col-lg-12">
                        		
                        			

                              @if(session('rs'))
                              <div class="alert alert-{{session('rs')['status']}}">
                                {{ session('rs')['msg'] }}
                              </div>
                              @endif
			                       <div class="panel panel-border panel-success">
                  <div class="panel-heading">
                    <h3 class="panel-title">租赁日志</h3>
                  </div>
                  <div class="panel-body">  
                        			<div class="table-responsive">
    <table class="table table-hover">
        <thead>
			<tr>
				<th>ID</th>
						           
                                          
                        
                      
                        <th>租金</th>
                        <th>收租日期</th>
                        <th>下次应收金额</th>
                        <th>下次收款日期</th>
                        <th>出险情况</th>
                        <th>更换车车牌号</th>
                        <th>更换车车型</th>

                        <th>备注</th>
                        <th>录入时间</th>
                        
                          
                        
                         
						
                         
					<th>操作</th>
					</tr>
					</thead>
											
                    <tbody>

                    @foreach($list as $v)
                        <tr>
                            <td>{{$v->id}}</td>
                            <td>{{$v->price}}</td>                        
                            <td>{{$v->priced_at}}</td>

                                                   
                       <td>{{$v->next_price}}</td>                             
                      <td>{{$v->next_date}}</td>
                      
                      <td>{{$v->baoxian_info}}</td>
                     
                      <td>{{$v->car_num}}</td>
                       <td>{{$v->car_model}}</td>
                      <td>{{$v->remark}}</td>
                      <Td>{{$v->created_at}}</Td>
                                                  
                                                    
                                                    
                                                   
                                                   <td>

                                                      <a href="{{url('zadmin/rent-log/'.$v->id.'/edit')}}" class="btn btn-info btn-sm" ><i class="md md-edit"></i>编辑</a>
                                                      <a href="{{url('zadmin/rent-log',$v->id)}}" data-method="delete" 
  data-token="{{csrf_token()}}" data-confirm="确定删除吗?" class="btn btn-danger btn-sm"><i class="md md-close"></i>删除</a>
                                                    </td>
                                                </tr>
                                            @endforeach    
                                                
                                               
                                               
                                                
                                               
                                                
                                            
                                            </tbody>
                                        </table>
                                      </div>
                                    </div>
                                    {{ $list->appends($param)->links() }}
                                  </div>
                        	
                                
                            </div> <!-- end col -->

                            
                        </div>
@endsection

@section('modal')                        

<!-- /.modal -->                        
@endsection                         

                  
            
    
       

           



    
@section('js')
<script type="text/javascript" src="{{asset('admin/plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js')}}"></script>
<script type="text/javascript" src="{{asset('admin/plugins/bootstrap-datepicker/js/locales/bootstrap-datepicker.zh-CN.js')}}" charset="UTF-8"></script>
<script type="text/javascript">
    $('#showbox').on('click',function(){
       $('#log-box').toggle(1000);
    });

   $('.date').datepicker({
        format: "yyyy-mm-dd",
        autoclose: true,
        todayBtn: true,
        startDate: new Date()
       
    });
</script>
         
@endsection
    
